package com.dmj.sqldsl.builder.column.type;

import java.util.Optional;
import lombok.EqualsAndHashCode;
import lombok.Getter;

@Getter
@EqualsAndHashCode
public class TypeClass {

  private final Class<?> type;

  private String id;

  public TypeClass(Class<?> type) {
    this.type = type;
  }

  public TypeClass(Class<?> type, String id) {
    this.type = type;
    this.id = id;
  }

  public String getId() {
    return Optional.ofNullable(id).orElse(String.valueOf(type.hashCode()));
  }
}
